package com.mytools.common.pattern.composite03;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LJK
 * @description
 * @date 2025/2/24
 */
public class City implements Count{

    final String name;
    List<County>countyList=new ArrayList<>();

    public City(String name) {
        this.name = name;
    }
    public void add(County county){
        this.countyList.add(county);
    }
    @Override
    public int getValue() {
        return countyList.stream().mapToInt(County::getValue).sum();
    }
}
